/**
 * API模块统一入口
 * 统一导出所有API模块和类型
 */

// 认证相关API
export { authAPI } from './auth'
export type {
  LoginRequest,
  LoginResponseData,
  RefreshTokenResponseData,
  ChangePasswordRequest,
  RegisterRequest,
  UserInfo,
  UserRole,
  UserStatus
} from './auth'

// 用户管理API
export { userAPI } from './user'
export type {
  User,
  UserCreateRequest,
  UserUpdateRequest,
  UserListParams
} from './user'

// 班级管理API
export { classAPI } from './class'
export type {
  EduClass,
  Student,
  ClassCreateRequest,
  ClassUpdateRequest,
  ClassListParams,
  ClassStatistics
} from './class'

// 健康检查API
export const healthAPI = {
  /**
   * 系统健康检查
   */
  async checkHealth(): Promise<any> {
    const { request } = await import('@/utils/request')
    return request.get('/health', {}, {
      showLoading: false,
      showError: false
    })
  },

  /**
   * Ping接口
   */
  async ping(): Promise<string> {
    const { request } = await import('@/utils/request')
    return request.get('/health/ping', {}, {
      showLoading: false,
      showError: false
    })
  }
}

// 通用响应类型
export interface ApiResponse<T> {
  code: number
  message: string
  data: T
  timestamp: string
  requestId?: string
  success?: boolean
  error?: boolean
}

// 分页响应类型
export interface PageResponse<T> {
  list: T[]
  total: number
  page: number
  pageSize: number
  totalPages?: number
}